package com.gl.emms.whale.ui;

import android.net.NetworkInfo;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

import com.gl.emms.whale.R;
import com.gl.emms.whale.app.WhaleMonitorActivity;
import com.gl.emms.whale.util.SystemMsgEntity;

/**系统消息界面类
 * @author ganlinux
 *
 */
public class SystemMsgActivity extends WhaleMonitorActivity implements
OnClickListener{
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);// 去掉标题栏
		setContentView(R.layout.activity_systemmsg);
		initViews();
		
		
	}

	@Override
	public void onClick(View arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void initViews() {
		// TODO Auto-generated method stub
		SystemMsgEntity systemMsgEntity = (SystemMsgEntity)getIntent().getSerializableExtra("systemMsgEntity");
		TextView title_item = (TextView) findViewById(R.id.title_item);
		title_item.setText(systemMsgEntity.getMsgTitle());
		
		TextView from_item = (TextView) findViewById(R.id.from_item);
		from_item.setText(systemMsgEntity.getMsgFrom());
		
		TextView time_item = (TextView) findViewById(R.id.time_item);
		time_item.setText(systemMsgEntity.getDate());
		
		TextView msg_item = (TextView) findViewById(R.id.msg_item);
		msg_item.setText(systemMsgEntity.getMessage());
		
		Button titleBackBtn = (Button)findViewById(R.id.TitleBackBtn);  
        titleBackBtn.setOnClickListener(new OnClickListener() {  
            public void onClick(View v) {  
                KeyEvent newEvent = new KeyEvent(KeyEvent.ACTION_DOWN,  
                        KeyEvent.KEYCODE_BACK);
                finish();
                //mActivity.onKeyDown(KeyEvent.KEYCODE_BACK, newEvent);  
            }  
        });
	}
}